package com.sqly.doc;


import android.annotation.SuppressLint;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.sqly.doc.menu.fjh.fjh_menu;
import com.sqly.doc.menu.grjbxx.grjbxx_menu;
import com.sqly.doc.menu.jktjb.tjb_list;
import com.sqly.doc.menu.jsjb.jsjb_menu;
import com.sqly.doc.menu.laonian.lnr_nlpg_list;
import com.sqly.doc.menu.manbing.manbing_menu;
import com.sqly.doc.menu.ycf.ycf_menu;
import com.sqly.doc.menu.yyye.yyye_menu;
import com.sqly.doc.menu.zyy.zyy_list;
import com.sqly.doc.view.AdView;
import com.sqly.doc.view.ImageInfo;

import java.util.ArrayList;

//import cn.pedant.SweetAlert.SweetAlertDialog;
import com.cazaea.sweetalert.SweetAlertDialog;

@SuppressLint("NewApi")
public class sy_fragment extends Fragment {
    private ArrayList<ImageInfo> l;
    private AdView adView;
    LinearLayout grjbxx,ycf,yyye,lnr,mb,fjh,jsjb,zyy,jtbc,tjbll;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.sy_fragment, null);
        adView = (AdView) view.findViewById(R.id.adview);
        //滚动图片
        loadImagge();
        initView(view);
        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
    }

    public void initView(View v){
        grjbxx =(LinearLayout)v.findViewById(R.id.grjbxx);
        grjbxx.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),grjbxx_menu.class));
            }
        });
        ycf =(LinearLayout)v.findViewById(R.id.ycf);
        ycf.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),ycf_menu.class));
            }
        });
        yyye =(LinearLayout)v.findViewById(R.id.yyye);
        yyye.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),yyye_menu.class));
            }
        });

        lnr =(LinearLayout)v.findViewById(R.id.lnr);
        lnr.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),lnr_nlpg_list.class));
            }
        });
        mb =(LinearLayout)v.findViewById(R.id.mb);
        mb.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),manbing_menu.class));
            }
        });
        fjh =(LinearLayout)v.findViewById(R.id.fjh);
        fjh.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),fjh_menu.class));
            }
        });

        jsjb =(LinearLayout)v.findViewById(R.id.jsjb);
        jsjb.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),jsjb_menu.class));
            }
        });
        zyy =(LinearLayout)v.findViewById(R.id.zyy);
        zyy.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),zyy_list.class));
            }
        });
        tjbll =(LinearLayout)v.findViewById(R.id.tjbll);
        tjbll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), tjb_list.class));
            }
        });

        jtbc =(LinearLayout)v.findViewById(R.id.jtbc);
        jtbc.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                new SweetAlertDialog(getActivity(), SweetAlertDialog.ERROR_TYPE)
                        .setTitleText("提示")
                        .setContentText("敬请期待。。。")
                        .show();
            }
        });

    }


    public void loadImagge() {
        l = new ArrayList<ImageInfo>();
        ImageInfo f = new ImageInfo();
        f.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=06bffd9f40ea2ca44ce10f423952b449&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3Dbd95dc96b3389b502cf2e811ed5c8fa8%2F4ec2d5628535e5dd6c5563577cc6a7efce1b6239.jpg");
        l.add(f);
        ImageInfo f1 = new ImageInfo();
        f1.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=d91f867cc79a8b29d89f23d7edafb74a&imgtype=0&src=http%3A%2F%2Fimage.suning.cn%2Fuimg%2Fsop%2Fcommodity%2F201408040415267430_x.jpg");
        l.add(f1);
        ImageInfo f2 = new ImageInfo();
        f2.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=751e4ee58e9c72c4e556ddc3ae3a9968&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3D0aa8ee4c05b30f242197e440a0fcbb36%2F43a7d933c895d143dc6aa10e79f082025aaf07fa.jpg");
        l.add(f2);
        ImageInfo f3 = new ImageInfo();
        f3.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659567&di=0b0e2fca08da072b52adff84345e8070&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3Db0eba2c45d2c11dfcadcb7600b4e08a5%2Fa8ec8a13632762d02531c198aaec08fa513dc68e.jpg");
        l.add(f3);
        adView.setWebDate(getActivity(), l);
    }

}
